<#include "../common/layout/__mainlayout.html">

    <!--设置面包屑-->
    <#assign pageBreadCrumbs>
        <li class="active"><a href="#">上传&审核</a></li>
        <li class="active">上传应用</li>
    </#assign>
    <#assign pageCss>
        <!-- page specific plugin styles -->
        <link rel="stylesheet" href="${ctx}/static/admin/assets/css/jquery-ui.custom.css" />
        <link rel="stylesheet" href="${ctx}/static/admin/assets/css/chosen.css" />
        <link rel="stylesheet" href="${ctx}/static/admin/assets/css/datepicker.css" />
    </#assign>

    <#assign pageJavascript>
        <script src="${ctx}/static/admin/assets/js/jquery.dataTables.js"></script>
        <script src="${ctx}/static/admin/assets/js/jquery.dataTables.bootstrap.js"></script>
        <script src="${ctx}/static/admin/assets/js/ajaxfileupload.js"></script>
        <script src="${ctx}/static/admin/assets/js/bootstrap-wysiwyg.js"></script>
        <script src="${ctx}/static/admin/assets/js/jquery.validate.js"></script>
        <script src="${ctx}/static/admin/assets/js/jquery.validate.messages_zh.js"></script>
        <script type="text/javascript">
            var $path_assets = "${ctx}/static/admin/assets/";//this will be used in loading jQuery UI if needed!
        </script>
        <script type="text/javascript">
            jQuery(function($){

                if(!ace.vars['touch']) {
                    $('.chosen-select').chosen({allow_single_deselect:true});
                    //resize the chosen on window resize

                    $(window)
                            .off('resize.chosen')
                            .on('resize.chosen', function() {
                                $('.chosen-select').each(function() {
                                    var $this = $(this);
                                    $this.next().css({'width': $this.parent().width()});
                                })
                            }).trigger('resize.chosen');
                    //resize chosen on sidebar collapse/expand
                    $(document).on('settings.ace.chosen', function(e, event_name, event_val) {
                        if(event_name != 'sidebar_collapsed') return;
                        $('.chosen-select').each(function() {
                            var $this = $(this);
                            $this.next().css({'width': $this.parent().width()});
                        })
                    });


                    $('#chosen-multiple-style .btn').on('click', function(e){
                        var target = $(this).find('input[type=radio]');
                        var which = parseInt(target.val());
                        if(which == 2) $('#form-field-select-4').addClass('tag-input-style');
                        else $('#form-field-select-4').removeClass('tag-input-style');
                    });
                }

                $("#categoryId").change(function () {
                    //清除二级下拉列表
                    $("#categoryId2").empty();
                    $("#categoryId3").empty();
                    if($(this).val() !=0){

                        $("#categoryId2").append($("<option/>").text("--请选择二级分类--").attr("value","0"));
                        //要请求的二级下拉JSON获取页面
                        var url="${ctx}/admin/category/categoryList.do";
                        //将选中的一级下拉列表项的id传过去
                        $.getJSON(url, { parentId:$(this).val() },function (data) {
                            //对请求返回的JSON格式进行分解加载
                            $(data.data).each(function () {
                                $("#categoryId2").append($("<option/>").text(this.categoryName).attr("value",this.id));
                            });
                        });
                    }
                });

                $("#categoryId2").change(function () {
                    //清除二级下拉列表
                    $("#categoryId3").empty();
                    if($(this).val() !=0){
                        $("#categoryId3").append($("<option/>").text("--请选择三级分类--").attr("value","0"));
                        //要请求的二级下拉JSON获取页面
                        var url="${ctx}/admin/category/categoryList.do";
                        //将选中的一级下拉列表项的id传过去
                        $.getJSON(url, { parentId:$(this).val() },function (data) {
                            //对请求返回的JSON格式进行分解加载
                            $(data.data).each(function () {
                                $("#categoryId3").append($("<option/>").text(this.categoryName).attr("value",this.id));
                            });
                        });
                    }

                });
                function showErrorAlert (reason, detail) {
                    var msg='';
                    if (reason==='unsupported-file-type') { msg = "Unsupported format " +detail; }
                    else {
                        //console.log("error uploading file", reason, detail);
                    }
                    $('<div class="alert"> <button type="button" class="close" data-dismiss="alert">&times;</button>'+
                    '<strong>File upload error</strong> '+msg+' </div>').prependTo('#alerts');
                }

                $('#descriptiondiv').ace_wysiwyg({
                    toolbar:
                            [
                                'font',
                                null,
                                'fontSize',
                                null,
                                {name:'bold', className:'btn-info'},
                                {name:'italic', className:'btn-info'},
                                {name:'strikethrough', className:'btn-info'},
                                {name:'underline', className:'btn-info'},
                                null,
                                {name:'insertunorderedlist', className:'btn-success'},
                                {name:'insertorderedlist', className:'btn-success'},
                                {name:'outdent', className:'btn-purple'},
                                {name:'indent', className:'btn-purple'},
                                null,
                                {name:'justifyleft', className:'btn-primary'},
                                {name:'justifycenter', className:'btn-primary'},
                                {name:'justifyright', className:'btn-primary'},
                                {name:'justifyfull', className:'btn-inverse'},
                                null,
                                {name:'createLink', className:'btn-pink'},
                                {name:'unlink', className:'btn-pink'},
                                null,
                                {name:'insertImage', className:'btn-success'},
                                null,
                                'foreColor',
                                null,
                                {name:'undo', className:'btn-grey'},
                                {name:'redo', className:'btn-grey'}
                            ],
                    'wysiwyg': {
                        fileUploadError: showErrorAlert
                    }
                }).prev().addClass('wysiwyg-style2');

                $("#softItemForm").validate({
                    errorElement: 'div',
                    errorClass: 'help-block',
                    focusInvalid: true,
                    highlight: function (e) {
                        $(e).closest('.form-group').removeClass('has-info').addClass('has-error');
                    },
                    success: function (e) {
                        $(e).closest('.form-group').removeClass('has-error');//.addClass('has-info');
                        $(e).remove();
                    },
                    errorPlacement: function (error, element) {
                        if (element.is('input[type=checkbox]') || element.is('input[type=radio]')) {
                            var controls = element.closest('div[class*="col-"]');
                            if (controls.find(':checkbox,:radio').length > 1) controls.append(error);
                            else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
                        }
                        else if (element.is('.select2')) {
                            error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));
                        }
                        else if (element.is('.chosen-select')) {
                            error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));
                        }
                        else error.insertAfter(element.parent());
                    },

                    submitHandler: function (form) {
                        $.ajax({
                            cache: true,
                            type: "POST",
                            url:"${ctx}/admin/soft/save.do",
                            data:$('#softItemForm').serialize(),// 你的formid
                            async: false,
                            error: function(request) {
                                alert("Connection error");
                            },
                            success: function(data) {
                                if(data.result == "success"){
                                    window.location="${refer!}";
                                }else{
                                    alert(data.messages);
                                }
                            }
                        });
                    },
                    invalidHandler: function (form) {
                    }
                });
            })
        </script>

        <script type="text/javascript">
            function uploadApkFile(){
                $.blockUI();
                $.ajaxFileUpload({
                    url:"${ctx}/admin/upload/uploadApkFile.do?inputName=apkfile",            //需要链接到服务器地址
                    dataType : 'text/html',
                    fileElementId:'id-input-apk',                        //文件选择框的id属性
                    success: function(data, status){
                        $.unblockUI();
                        msg = jQuery.parseJSON(jQuery(data).text());
                        if(msg.result == "success"){
                            var upload=msg.data;
                            $(upload.secondCatagories).each(function () {
                                $("#categoryId2").append($("<option/>").text(this.categoryName).attr("value",this.id));
                            });
                            if(upload.thirdCatagories){
                                $(upload.thirdCatagories).each(function () {
                                    $("#categoryId3").append($("<option/>").text(this.categoryName).attr("value",this.id));
                                });
                            }
                            if(upload.exist){
                                if(confirm("该APK已上传,对应版本ID为:"+upload.softVO.softItemId+"。确定要覆盖该版本？")){
                                    $("#softItemId").val(upload.softVO.softItemId);
                                    initApkInf(upload);
                                }else{
                                    return;
                                }
                            }else{
                                initApkInf(upload);
                            }

                        }else{
                            alert(msg.messages);
                        }
                    },error: function (data, status, e){
                        $.unblockUI();
                        alert("上传出错，请确认包完整性再上传");
                    }
                });
            }

            function initApkInf(upload){
                $("#fileUrl").val(upload.fileUrl);
                //apk基础信息
                $("#packageName").val(upload.softVO.packageName);
                $("#versionCode").val(upload.softVO.versionCode);
                $("#versionName").val(upload.softVO.versionName);
                $("#minFirewareId").val(upload.softVO.minFirewareId);
                $("#minFirewareName").val(upload.softVO.minFirewareName);
                $("#maxFirewareId").val(upload.softVO.maxFirewareId);
                $("#maxFirewareName").val(upload.softVO.maxFirewareName);
                $("#itemName").val(upload.softVO.itemName);
                $("#softName").val(upload.softVO.softName);
                $("#permission").val(upload.softVO.permission);
                $("#fileMD5").val(upload.softVO.fileMD5);
                $("#fileSize").val(upload.softVO.fileSize);
                $("#resolutionShow").val(upload.softVO.resolutionShow);
                $("#resolution").val(upload.softVO.resolution);

                //Soft信息
                $("#softId").val(upload.softVO.softId);
                $("#lastSoftItemId").val(upload.softVO.lastSoftItemId);
                $("#packageName").val(upload.softVO.packageName);
                $("#softName").val(upload.softVO.softName);

                $("#categoryId").val(upload.softVO.categoryId);
                $("#categoryId2").val(upload.softVO.categoryId2);
                $("#categoryId3").val(upload.softVO.categoryId3);

                $("#isAccredit").val(upload.softVO.isAccredit);
                $("#sysStarsEnable").val(upload.softVO.sysStarsEnable);
                $("#sysStars").val(upload.softVO.sysStars);
                $("#commentStars").val(upload.softVO.commentStars);
                $("#isOfficial").val(upload.softVO.isOfficial);
                $("#seo").val(upload.softVO.seo);
                $("#developerName").val(upload.softVO.developerName);
                $("#developerPhone").val(upload.softVO.developerPhone);
                $("#developerEmail").val(upload.softVO.developerEmail);
                $("#developerSite").val(upload.softVO.developerSite);
                $("#downloadNumber").val(upload.softVO.downloadNumber);
                $("#summary").val(upload.softVO.summary);
                $("#description").val(upload.softVO.description);
                $("#descriptiondiv").html(upload.softVO.description);
            }



            function uploadIconFile(){
                $.blockUI();
                $.ajaxFileUpload({
                    url:"${ctx}/admin/upload/uploadIconFile.do?inputName=iconFile",            //需要链接到服务器地址
                    dataType : 'text/html',
                    fileElementId:'id-input-icon',                        //文件选择框的id属性
                    success: function(data, status){
                        $.unblockUI();
                        msg = jQuery.parseJSON(jQuery(data).text());
                        if(msg.result == "success"){
                            var upload=msg.data;
                            $("#icon512").attr("src","${staticHost}"+upload.icon512Url);
                            $("#icon512a").attr("href","${staticHost}"+upload.icon512Url);
                            $("#icon125").attr("src","${staticHost}"+upload.icon125Url);
                            $("#icon125a").attr("href","${staticHost}"+upload.icon125Url);
                            $("#icon114").attr("src","${staticHost}"+upload.icon114Url);
                            $("#icon114a").attr("href","${staticHost}"+upload.icon114Url);
                            $("#icon62").attr("src","${staticHost}"+upload.icon62Url);
                            $("#icon62a").attr("href","${staticHost}"+upload.icon62Url);
                            $("#iconUrl").val(upload.iconUrl);
                        }else{
                            alert(msg.messages);
                        }
                    },error: function (data, status, e){
                        $.unblockUI();
                        alert("上传出错，请重新上传");
                    }
                });
            }

            function uploadAdFile(){
                $.blockUI();
                $.ajaxFileUpload({
                    url:"${ctx}/admin/upload/uploadAdFile.do?inputName=adFile",            //需要链接到服务器地址
                    dataType : 'text',
                    fileElementId:'id-input-ad',                        //文件选择框的id属性
                    success: function(data, status){
                        $.unblockUI();
                        msg = jQuery.parseJSON(jQuery(data).text());
                        if(msg.result == "success"){
                            var upload=msg.data;
                            $("#ad").attr("src","${staticHost}"+upload.adUrl);
                            $("#ada").attr("href","${staticHost}"+upload.adUrl);
                            $("#adthumb").attr("src","${staticHost}"+upload.adThumbUrl);
                            $("#adthumba").attr("href","${staticHost}"+upload.adThumbUrl);
                            $("#adIconUrl").val(upload.adUrl);
                        }else{
                            alert(msg.messages);
                        }
                    },error: function (data, status, e){
                        $.unblockUI();
                        alert("上传出错，请重新上传");
                    }
                });
            }

            function uploadScreenShot(){
                $.blockUI();
                $.ajaxFileUpload({
                    url:"${ctx}/admin/upload/uploadScreenShot.do?inputName=screenshotFile",            //需要链接到服务器地址
                    dataType : 'text',
                    fileElementId:'id-input-screenshot',                        //文件选择框的id属性
                    success: function(data, status){
                        $.unblockUI();
                        msg = jQuery.parseJSON(jQuery(data).text());
                        if(msg.result == "success"){
                            var upload=msg.data;
                            liString = '<li>'
                            +'<a href="'+upload.screenUrl+'" data-rel="colorbox">'
                            +'<img width="150" height="150" alt="62*62" src="'+"${staticHost}"+upload.screenUrl+'" />'
                            +'</a>'
                            +'<input id="screenshotId" name="screenshotId" type="hidden" value="'+upload.id+'"/>'
                            +'<input id="screenshotUrl" name="screenshotUrl" type="hidden" value="'+upload.screenUrl+'"/>'
                            +'<div class="tools tools-bottom">'
                            +'<a onclick="delScreenshot(this)"> <i class="ace-icon fa fa-times red"></i></a>'
                            +'</div>'
                            +'</li>';
                            $("#screenshotul").append(liString);
                        }else{
                            alert(msg.messages);
                        }
                    },error: function (data, status, e){
                        $.unblockUI();
                        alert("上传出错，请重新上传");
                    }
                });
            }

            function delScreenshot(image){
                bootbox.confirm({
                            message: "确定删除该截图?",
                            buttons: {
                                confirm: {
                                    label: "确定",
                                    className: "btn-primary btn-sm"
                                },
                                cancel: {
                                    label: "取消",
                                    className: "btn-sm"
                                }
                            },
                            callback: function(result) {
                                if(result){
                                    screenshotSoftItemId = $(image).parent().parent().children("#screenshotSoftItemId").val();
                                    if(screenshotSoftItemId!=""){
                                        $.get("${ctx}/admin/soft/delScreenshot.do", { id: screenshotSoftItemId},function(data){
                                            $(image).parent().parent().remove();
                                        });
                                    }else{
                                        $(image).parent().parent().remove();
                                    }
                                }
                            }
                        }
                );

            }

            function submitSoft(submitType){
                var categoryId = $("#categoryId").val();
                if(categoryId == 0){
                    alert("请选择分类");
                    return false;
                }
                var screenShotLength = $("#screenshotul").children().length;
                if(screenShotLength<2 || screenShotLength >5){
                    alert("请上传2-5张软件截图");
                    return false;
                }
                $("#submitType").val(submitType);
                $("#description").val($("#descriptiondiv").html());
                //处理设备多选
                o = document.getElementById("deviceType");
                t = document.getElementById("deviceTypeList");
                var intvalue="";
                for(i=0;i<o.length;i++){
                    if(o.options[i].selected){
                        intvalue+=o.options[i].value+",";
                    }
                }
                t.value=intvalue.substr(0,intvalue.length-1);

                $('#softItemForm').submit();
            }

            $('#id-input-apk,#id-input-icon,#id-input-gamecut,#id-input-ad,#id-input-screenshot').ace_file_input({
                no_file:'未选择文件 ...',
                btn_choose:'浏览',
                btn_change:'更改',
                droppable:false,
                onchange:null,
                thumbnail:false //| true | large
                //whitelist:'gif|png|jpg|jpeg'
                //blacklist:'exe|php'
                //onchange:''
                //
            });
        </script>
    </#assign>

    <@mainlayout pageBreadCrumbs=pageBreadCrumbs pageCss=pageCss pageJavascript=pageJavascript currentMenu="appUploadFlag-addApkFlag">
    <form id="softItemForm" class="form-horizontal" action="${ctx}/admin/soft/save.do" method="post">
        <!--上传APK块---->
        <div class="row">
            <div class="col-sm-12">
                <div class="widget-box">
                    <div class="widget-header">
                        <h4 class="widget-title">上传应用</h4>

                    </div>

                    <div class="widget-body">
                        <div class="widget-main">
                            <div class="form-group">
                                <div class="col-xs-8">
                                    <!-- #section:custom/file-input -->
                                    <input type="file" id="id-input-apk" name="apkfile" class="required"/>

                                </div>
                                <button type="button" id="id-button-apk" class="btn btn-sm btn-success" onclick="uploadApkFile()">
                                    上传 <i class="ace-icon fa fa-arrow-right icon-on-right bigger-60"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div id="firstDiv" ></div>
        <!--上传ICON块---->
        <div class="row">
            <div class="col-sm-12">
                <div class="widget-box">
                    <div class="widget-header">
                        <h4 class="widget-title">上传图标(512x512.png)</h4>

                    </div>

                    <div class="widget-body">
                        <div class="widget-main">
                            <div class="form-group">
                                <div class="col-xs-8">
                                    <!-- #section:custom/file-input -->
                                    <input type="file" id="id-input-icon" name="iconFile" class="required"/>
                                </div>
                                <button type="button" id="id-button-icon" class="btn btn-sm btn-success" onclick="uploadIconFile()">
                                    上传 <i class="ace-icon fa fa-arrow-right icon-on-right bigger-60"></i>
                                </button>
                            </div>
                        </div>
                    </div>

                    <div class="widget-body">
                        <div class="widget-main">
                            <div>
                                <ul class="ace-thumbnails clearfix">

                                    <li><a id="icon512a" name="icon512a" data-rel="colorbox">
                                        <img id="icon512" name="icon512" width="256" height="256"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'" />
                                        </a>
                                    </li>
                                    <li><a id="icon125a" name="icon125a" data-rel="colorbox">
                                        <img id="icon125" name="icon125" width="62" height="62"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'" />
                                    </a>
                                    </li>
                                    <li><a id="icon114a" name="icon114a" data-rel="colorbox">
                                        <img id="icon114" name="icon114" width="57" height="57"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'" />
                                    </a>
                                    </li>
                                    <li><a id="icon62a" name="icon62a" data-rel="colorbox">
                                        <img id="icon62" name="icon62" width="31" height="31"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'" />
                                    </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!----上传广告图-------->
        <div class="row">
            <div class="col-sm-12">
                <div class="widget-box">
                    <div class="widget-header">
                        <h4 class="widget-title">上传广告图</h4>

                    </div>

                    <div class="widget-body">
                        <div class="widget-main">
                            <div class="form-group">
                                <div class="col-xs-8">
                                    <!-- #section:custom/file-input -->
                                    <input type="file" id="id-input-ad" name="adFile"/>
                                </div>
                                <button type="button" id="id-button-ad" class="btn btn-sm btn-success" onclick="uploadAdFile()">
                                    上传 <i class="ace-icon fa fa-arrow-right icon-on-right bigger-60"></i>
                                </button>

                            </div>
                        </div>
                    </div>

                    <div class="widget-body">
                        <div class="widget-main">
                            <div>
                                <ul class="ace-thumbnails clearfix">

                                    <li><a id="ada" name="ada" data-rel="colorbox">
                                        <img id="ad" name="ad" width="150"  onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'"/>
                                    </a>
                                    </li>
                                    <li><a id="adthumba" name="adthumba" data-rel="colorbox">
                                        <img id="adthumb" name="adthumb" width="80"   onerror="this.src='${ctx}/static/admin/assets/img/imgerror.png'" />
                                    </a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <!----上传截图块-------->
        <div class="row">
            <div class="col-sm-12">
                <div class="widget-box">
                    <div class="widget-header">
                        <h4 class="widget-title">上传软件截图</h4>

                    </div>

                    <div class="widget-body">
                        <div class="widget-main">
                            <div class="form-group">
                                <div class="col-xs-8">
                                    <!-- #section:custom/file-input -->
                                    <input type="file" id="id-input-screenshot" name="screenshotFile" id="id-input-screenshot" />
                                </div>
                                <button type="button" id="id-button-screenshot" class="btn btn-sm btn-success" onclick="uploadScreenShot()">
                                    上传 <i class="ace-icon fa fa-arrow-right icon-on-right bigger-60"></i>
                                </button>
                            </div>
                        </div>
                    </div>

                    <div class="widget-body">
                        <div class="widget-main">
                            <div>
                                <ul id="screenshotul" class="ace-thumbnails clearfix">

                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>


            <!---软件信息----->
            <div class="row">
                <div class="col-sm-12">
                    <div class="widget-box">
                        <div class="widget-header">
                            <h4 class="widget-title">软件信息</h4>

                        </div>

                        <div class="widget-body">
                            <div class="widget-main">
                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="softId">软件编号:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" readonly="" name="softId" id="softId" class="form-control col-sm-4" value=""/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="lastSoftItemId">最新版本:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" readonly="" name="lastSoftItemId" id="lastSoftItemId" class="form-control col-sm-4" value=""/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="packageName">软件包名:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" readonly="" name="packageName" id="packageName" class="form-control col-sm-4 required" value=""/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="softName">软件名称:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="softName" id="softName" class="form-control col-sm-4 required" value=""/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="isAccredit">是否授权:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="isAccredit" id="isAccredit" data-placeholder="Choose a State...">
                                                    <option value="1">是</option>
                                                    <option value="0">否</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="sysStarsEnable">开启星级:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="sysStarsEnable" id="sysStarsEnable" data-placeholder="Choose a State...">
                                                    <option value="0">关闭</option>
                                                    <option value="1">开启</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="sysStars">系统星级:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="sysStars" id="sysStars"  data-placeholder="Choose a star...">
                                                    <option value=""></option>
                                                    <#list starEnums?keys as key>
                                                        <option value="${starEnums[key]?default('')}">${key}</option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="commentStars">评论星级:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="commentStars" id="commentStars"  data-placeholder="Choose a star...">
                                                    <option value=""></option>
                                                    <#list starEnums?keys as key>
                                                        <option value="${starEnums[key]?default('')}">${key}</option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="isOfficial">是否官方:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="isOfficial" id="isOfficial" data-placeholder="Choose a State...">
                                                    <option value="1">是</option>
                                                    <option value="0">否</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="downloadNumber">总下载量:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="number" name="downloadNumber" id="downloadNumber" class="form-control col-sm-4" value=""/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="seo">搜索关键词（用空格隔开）:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="seo" id="seo" class="form-control col-sm-4 required" value=""/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="developerName">开发者名称:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="developerName" id="developerName" class="form-control col-sm-4" value=""/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="developerPhone">开发者手机/电话:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="developerPhone" id="developerPhone" class="form-control col-sm-4" value=""/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="developerEmail">开发者邮箱:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="developerEmail" id="developerEmail" class="form-control col-sm-4" value=""/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="developerSite">开发者网站:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="developerSite" id="developerSite" class="form-control col-sm-4" value=""/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="categoryId">软件分类:</label>
                                    <div class="col-xs-12 col-sm-3">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control"  name="categoryId" id="categoryId" data-placeholder="请选择一级分类">
                                                    <option value="0">--请选择一级分类--</option>
                                                    <#list firstCatagories as first>
                                                        <option value="${first.id}" >
                                                            ${(first.categoryName)!}
                                                        </option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-xs-12 col-sm-3">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="categoryId2" id="categoryId2" data-placeholder="请选择二级分类">
                                                    <option value="0">请选择二级分类</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-xs-12 col-sm-3">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="categoryId3" id="categoryId3" data-placeholder="请选择三级分类">
                                                    <option value="0">请选择三级分类</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>


                                <div class="form-group">
                                    <div>
                                        <label class="control-label col-xs-12 col-sm-2" for="summary">软件简介:</label>
                                        <div class="control-label col-xs-10 col-sm-10 " >
                                            <textarea class=" col-sm-10 required maxlength:500" id="summary" name="summary" maxlength="500"></textarea>
                                        </div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="descriptiondiv">软件详细内容:</label>
                                    <div class="col-sm-10 " >
                                        <div class="wysiwyg-editor " id="descriptiondiv" name="descriptiondiv" style="border:1px solid #d5d5d5"></div>
                                        <textarea hidden="hidden" id="description" name="description"></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


            <!---版本信息----->
            <div class="row">
                <div class="col-sm-12">
                    <div class="widget-box">
                        <div class="widget-header ">
                            <h4 class="widget-title">版本信息</h4>
                        </div>
                        <div class="widget-body">
                            <div class="widget-main">
                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="softItemId">软件版本编号:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" readonly="" name="softItemId" id="softItemId" class="form-control col-sm-4" value=""/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2" for="itemName">软件具体名称:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="itemName" id="itemName" class="form-control col-sm-4 required" value=""/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="versionCode">版本号:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text"  name="versionCode" id="versionCode" readonly class="form-control col-sm-4 required" value=""/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="versionName">版本名称:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text"  name="versionName" id="versionName" class="form-control col-sm-4 required" value=""/>
                                        </div>
                                    </div>

                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="fileSize">软件大小:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" readonly="" name="fileSize" id="fileSize" class="form-control col-sm-4 required" value=""/>
                                            <input id="fileUrl" name="fileUrl" type="hidden"/>
                                            <input id="fileMD5" name="fileMD5" type="hidden"/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2" for="deviceTypeList">支持的设备类型:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <select multiple="" class="chosen-select form-control" name="deviceType"
                                                    id="deviceType" data-placeholder="Choose a State...">
                                                <#list terminals as t>
                                                    <option value="${t.itemValue}" >
                                                        ${(t.itemTitle)!}
                                                    </option>
                                                </#list>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">

                                    <label class="control-label col-xs-12 col-sm-2" for="language">语言:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control"  name="language" id="language" data-placeholder="Choose a State...">
                                                    <#list languages as lang>
                                                        <option value="${lang.itemValue}" >
                                                            ${(lang.itemTitle)!}
                                                        </option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2" for="isLastVersion">是否最新版本:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="isLastVersion" id="isLastVersion" data-placeholder="Choose a State...">
                                                    <option value="1">是</option>
                                                    <option value="0">否</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="minFirewareId">最小平台固件:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="minFirewareName" id="minFirewareName" class="form-control col-sm-4 " value=""/>
                                            <input type="hidden" name="minFirewareId" id="minFirewareId" class="form-control col-sm-4 " value=""/>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="maxFirewareId">最大平台固件:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <input type="text" name="maxFirewareName" id="maxFirewareName" class="form-control col-sm-4 " value=""/>
                                            <input type="hidden" name="maxFirewareId" id="maxFirewareId" class="form-control col-sm-4 " value=""/>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="adState">是否含广告:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control" name="adState" id="adState" data-placeholder="Choose a State...">
                                                    <option value="0">无广告</option>
                                                    <option value="1">有广告</option>
                                                    <option value="2">含恶意广告</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="safeState">安全级别:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control"  name="safeState" id="safeState" data-placeholder="Choose a State...">
                                                    <#list safeStates as state>
                                                        <option value="${state.itemValue}" >
                                                            ${(state.itemTitle)!}
                                                        </option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="resolution">分辨率尺寸值:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <input type="text" readonly="readonly"  name="resolutionShow" id="resolutionShow" class="form-control col-sm-4" value=""/>
                                                <input type="hidden"  name="resolution" id="resolution" class="form-control col-sm-4" value=""/>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="payType">付费方式:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control"  name="payType" id="payType" data-placeholder="Choose a State...">
                                                    <option value="0">免费</option>
                                                    <option value="1">付费</option>
                                                    <option value="2">限时免费</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-xs-12 col-sm-2" for="firstPublish">是否首发:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control"  name="firstPublish" id="firstPublish" data-placeholder="Choose a State...">
                                                    <option value="0">否</option>
                                                    <option value="1">是</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="softSrc">软件来源:</label>
                                    <div class="col-xs-12 col-sm-4">
                                        <div class="clearfix">
                                            <div>
                                                <select class="form-control required"  name="softSrc" id="softSrc" data-placeholder="Choose a State...">
                                                    <#list softSrcs as src>
                                                        <option value="${src.itemValue}" >
                                                            ${(src.itemTitle)!}
                                                        </option>
                                                    </#list>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div>
                                        <label class="control-label col-xs-12 col-sm-2" for="permission">软件拥有的执行权限:</label>
                                        <div class="control-label col-xs-10 col-sm-10 " >
                                            <textarea  readonly="" class=" col-sm-10 limited" name="permission" id="permission"  maxlength="1000"></textarea>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div>
                                        <label class="control-label col-xs-12 col-sm-2" for="updateDescription">版本更新介绍:</label>
                                        <div class="control-label col-xs-10 col-sm-10 " >
                                            <textarea class=" col-sm-10 limited required" id="updateDescription" name="updateDescription" maxlength="1000"></textarea>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <input id="adIconUrl" name="adIconUrl" type="hidden"/>
            <input id="iconUrl" name="iconUrl" type="hidden"/>
            <input type="hidden" name="submitType" id="submitType">
            <input type="hidden" name="deviceTypeList" id="deviceTypeList">
            <div class="clearfix form-actions">
                <div class="col-md-offset-3 col-md-9">
                    <button class="btn btn-info" type="button" onclick="submitSoft(0)">
                        <i class="ace-icon fa fa-check bigger-110"></i> 提交审核
                    </button>
                    &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                    <button class="btn btn-info" type="button" onclick="submitSoft(3)">
                        <i class="ace-icon fa fa-check bigger-110"></i> 直接发布
                    </button>
                    &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
                    <button class="btn" type="button" onclick="submitSoft(1)">
                        <i class="ace-icon fa fa-undo bigger-110"></i> 存入草稿箱
                    </button>
                </div>
            </div>
        </form>
    </@mainlayout>

    <div id="editModal" class="modal fade">
        <div class="modal-dialog" style="width: 1200px;">
            <div class="modal-content">
            </div>
        </div>
    </div>

